1. Field of the Invention
The present invention relates to image processing method and apparatus, and a storage medium.
2. Related Background Art
Hitherto, as processing of cutting out a specific object or target from an image, various types of methods have been known. As the first type, there are a method in which removal of background or designation of area for the object to be extracted is repeated with selecting an area having color component values (or shade values) within a predetermined range including the pixel values of points on the object and target designated by a user or the background, and a method in which a general rough contour line area or local area including the contour line of the extraction target, is designated, and a boundary contour line of the target is obtained in the designated area by processing such as thinning of line or clustering, and cut out.
As the second type, there is a method in which a closed curved line (or the boundary line of a polygon) is set to enclose roughly the image portion of the extraction target, and a cut-out mask image almost close to the shape of the target is generated using information on color component only.
As the third type, there is a method in which, in a construction for detecting a target from an image and extracting its contour, the contour is extracted using a dynamic contour method in which the position and the size of the target is obtained with referring to image dictionary data in which an input shade image is mosaicked by searching density using multiple resolution, and an initial contour is set based on them.
Other than these, as technique usable for judgement of presence of a specific body in an image, or retrieving an image in which a specific body is present, from a data base to extract, there are a method in which a template prepared in advance is scanned on an image, the matching degree at each position is calculated, and a position whose matching degree is not less than a predetermined threshold value, is searched, a method in which areas of components and the component names in images are input when an image date base is prepared, and images having a predetermined feature are retrieved rapidly, a method in which the similarity to an example (sketch, image, and the like) given by a user, is obtained, and images whose similarities are high are retrieved, a method in which a boundary line is detected using a shape model, and so on.
As one technique for modeling a curved line parametrically, there are a method in which a spline curve is used, a technique (literature 2) in which Fourier descriptor is used, a method in which wavelet descriptor is used, and so on.
However, since the image extraction method according to the above first type has need of operation by relatively detailed instructions of a user, processing of retrieving and extracting (cutting out) a target having a specific shape from an image can not be automated.
In the second type represented by the method in which a closed curved line or the like roughly enclosing the image portion of an extraction target, is designated, since the area rate of the areas having the same color component contained in the closed curved line is used, if there is an area of the same color as that of the object in the background in the closed curved line, or if the closed curved line area has twice or more area in comparison with the target area, there is the problem that erroneous extraction such as extraction of a background portion is apt to occur, and it lacks adaptability.
In the contour detection apparatus of the third method, since the so-called dynamic contour method is used, in case that the background portion (portion other than the extraction target) of an input image has a complex texture pattern, or the like, due to being affected by it, there are many cases that it is difficult to reflect the complexity of the contour line to be extracted. That is, there was the problem that an unnatural irregular shape departing from the original contour line shape was extracted.
In a contour extraction method on the assumption of a probability model assuming that the parameters of a contour model and the errors of the contour model are in Gaussian distribution, in case that their distributions are non-Gaussian in practice, it is difficult to extract the right contour efficiently, and the tolerance in relation to difference in shape between the contour model and the extraction target, is low.
It is an object of the present invention to provide image processing method and apparatus, and a storage medium, in which such problems are solved.
Taking into account the above-described object, a preferred embodiment of the present invention is characterized by comprising an image input step (means) of inputting an image, a feature quantity extraction step (means) of extracting a feature quantity distribution of the input image by said image input step (means), a template model input step (means) of inputting a template model including a plurality of representative points and curved lines or segments interconnecting said representative points as a figure element, a matching step (means) of performing matching processing between said template model and said feature quantity distribution, a shift condition set step (means) of setting a shift condition of said each representative point on the basis of a matching result of said matching step (means), a representative point update step (means) of shifting said each representative point in accordance with said shift condition, a template update step (means) of generating an update template including the representative points after shift and curved lines or segments interconnecting said representative points as a figure element, and an image extraction step (means) of extracting image data in an area within said update template from said input image.
Besides, taking into account the above-described object, a preferred embodiment of the present invention is characterized by comprising a step (means) of inputting an image, a feature quantity extraction step (means) of extracting a feature quantity distribution of the input image by said image input step (means), a template model input step (means) of inputting a template model including a plurality of representative points and curved lines or segments interconnecting said representative points as a figure element, a template set generation step (means) of generating a plurality of template sets different in size from each other, having figure elements generally similar to the figure element of said template model from said template model, a first matching step (means) of performing the first matching processing between said template sets and the feature quantity distribution of said input image, a template selection step (means) of selecting one of said template sets on the basis of a result of said first matching step (means), a second matching step (means) of performing the second matching processing to said feature quantity distribution as to each representative point of the template selected in said template selection step (means), a representative point update step (means) of shifting said representative point on the basis of a result of said second matching step (means), a template update step (means) of generating an update template including the representative points after shift and curved lines or segments interconnecting said representative points as a figure element, a mask area generation step (means) of generating a mask area including said figure element in said update template as a boundary line, and an image extraction step (means) of extracting one of the contour line of said mask area and image data corresponding to said mask area.
Besides, taking into account the above-described object, a preferred embodiment of the present invention is characterized by comprising an input step (means) of inputting an image, an input step (means) of inputting a template model, an update step (means) of updating the shape of said template model on the basis of the feature quantity of an image area to be extracted from said image, and an extraction step (means) of extracting said predetermined image area from said image on the basis of the shape of said updated template model.
The present invention relates to an image processing apparatus having a new function and an image processing method, and a storage medium.